<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>obj测试</title>
</head>

<body>
    <script>
        // 1.对象类题目：第一题：如何判断对象为空
        let obj = {
            name: "Lichen",
            age: 39
        }
        if (JSON.stringify(obj) == '{}') {
            console.log("为空数组")
        } else {
            console.log("不为空")
        }

        // 2. 检测一个属性在对象内是否存在
        let obj2 = {
            name: "Lichen",
            age: 39
        }
        if ('name' in obj2) {
            console.log("存在该属性")
        } else {
            console.log("不存在该属性")
        }

        // 3. 删除一个对象内的指定属性
        let obj3 = {
            name: "Lichen",
            age: 39
        }
        delete obj3.age;
        console.log(obj3)
    </script>
</body>

</html>